home *** CD-ROM | disk | FTP | other *** search
- Path: cp.ruhr.de!Diedrich_Vorberg
- Date: 17 Mar 1996 02:16:00 +0200
- From: Diedrich_Vorberg@cp.ruhr.de (Diedrich Vorberg)
- Newsgroups: comp.lang.c++
- Message-ID: <650$zNn8XdB@cp.ruhr.de>
- References: <4iemrd$iap@firebrick.mindspring.com>
- Subject: Re: Random number question....
- X-Newsreader: CrossPoint v3.1
-
- (Ryan Roberts) hat neulich folgendes geschrieben:
- (Ryan Roberts) wrote this a some time ago:
-
- > Can some tell me how to generate _one_ random number
- > between 0-5 and it disaply one the string assoicated with that
- > random number?
-
- Hi Ryan !
-
- Check this out:
-
- main()
- {
- char String[5][100];
- strcpy(String[0], "String 1"); //You might prefer to use Streams instead
- strcpy(String[0], "String 1"); //But I never got used to do that ...
- strcpy(String[0], "String 1");
- (...)
-
- randomize;
- n = rand() % 5;
-
- cout << String[n];
- };
-
- Something like that ?
-
- Hope I could help you...Diedrich :-)
- --
- From Diedrich_Vorberg@cp.prima.ruhr.de to you with love and in friendship
- FIDO: 2:2444/4538.14 Point der KASIMIR BBS +49-2330-890348
-